home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / StreetsAlleys.dxr / Internal_14_new tab card.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.5 KB  |  123 lines

  1. property spriteNum, motion, location, row
  2. global tableau, getlist, equal, currentsel, godlist, foundation, points, stock
  3.  
  4. on beginSprite me
  5.   if not listp(tableau) then
  6.     tableau = [:]
  7.   end if
  8.   row = determinerow()
  9.   if not objectp(tableau[row]) then
  10.     tableau.addProp(row, new(script("card pile")))
  11.   end if
  12.   if (row = #tone) or (row = #ttwo) or (row = #tthree) or (row = #tfour) then
  13.     if tableau[row].getcardcount() < 7 then
  14.       sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
  15.       stock.cards.deleteAt(1)
  16.       tableau[row].addCard(spriteNum)
  17.     end if
  18.   else
  19.     if (row = #tfive) or (row = #tsix) or (row = #tseven) or (row = #teight) then
  20.       if tableau[row].getcardcount() < 6 then
  21.         sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
  22.         stock.cards.deleteAt(1)
  23.         tableau[row].addCard(spriteNum)
  24.       end if
  25.     end if
  26.   end if
  27.   location = sprite(spriteNum).loc
  28. end
  29.  
  30. on mouseDown me
  31.   if tableau[row].getcardcount() > 0 then
  32.     if spriteNum = tableau[row].getlastcard().spnum then
  33.       puppetSound(3, member("pick card", "100GPak Generic SFX"))
  34.       sprite(spriteNum).locZ = spriteNum + 1000
  35.       getlist = tableau[row]
  36.       motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  37.     end if
  38.     if sprite(spriteNum).member = member("empty", "playing cards") then
  39.       sendSprite(spriteNum - 1, #mouseDown)
  40.     end if
  41.   end if
  42. end
  43.  
  44. on moving me
  45.   if the mouseDown then
  46.     sprite(spriteNum).loc = the mouseLoc
  47.   else
  48.     if the mouseUp then
  49.       sprite(spriteNum).locZ = spriteNum
  50.       motion.forget()
  51.       abort()
  52.     end if
  53.   end if
  54. end
  55.  
  56. on mouseUp me
  57.   if equal then
  58.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  59.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  60.     sprite(spriteNum).member = member("empty", "playing cards")
  61.     godlist.addCard(currentsel)
  62.     sprite(spriteNum).loc = location
  63.     tableau[row].cards.deleteOne(tableau[row].getlastcard())
  64.     if objectp(foundation[sprite(currentsel).row]) then
  65.       points = points + 10
  66.     end if
  67.     equal = 0
  68.     currentsel = 0
  69.     godlist = VOID
  70.     getlist = VOID
  71.     repeat with i = 132 to 139
  72.       if tableau[sprite(i).row].getcardcount() = 0 then
  73.         next repeat
  74.       end if
  75.       sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  76.     end repeat
  77.     checkwin()
  78.   else
  79.     if not equal then
  80.       if sprite(spriteNum).member.name <> "empty" then
  81.         puppetSound(3, member("drop card", "100GPak Generic SFX"))
  82.         getlist = VOID
  83.         sprite(spriteNum).loc = location
  84.       end if
  85.     end if
  86.   end if
  87.   checkwin()
  88. end
  89.  
  90. on determinerow me
  91.   if (spriteNum >= 14) and (spriteNum <= 27) then
  92.     return #tone
  93.   else
  94.     if (spriteNum >= 28) and (spriteNum <= 42) then
  95.       return #ttwo
  96.     else
  97.       if (spriteNum >= 43) and (spriteNum <= 56) then
  98.         return #tthree
  99.       else
  100.         if (spriteNum >= 57) and (spriteNum <= 70) then
  101.           return #tfour
  102.         else
  103.           if (spriteNum >= 71) and (spriteNum <= 84) then
  104.             return #tfive
  105.           else
  106.             if (spriteNum >= 85) and (spriteNum <= 99) then
  107.               return #tsix
  108.             else
  109.               if (spriteNum >= 100) and (spriteNum <= 113) then
  110.                 return #tseven
  111.               else
  112.                 if (spriteNum >= 114) and (spriteNum <= 127) then
  113.                   return #teight
  114.                 end if
  115.               end if
  116.             end if
  117.           end if
  118.         end if
  119.       end if
  120.     end if
  121.   end if
  122. end
  123.